/*
 * @Author: fishroom
 * @Date: 2022-09-27 17:31:47
 * @LastEditTime: 2023-01-04 20:22:42
 * @FilePath: \koa\app\router\admin.ts
 */
import KoaRouter from "koa-router";
import AdminController from "../controller/AdminController";
import captchaCodeController from "../controller/captchaCodeController";
import SysRoleController from "../controller/Sys/SysRoleController";
import SysRoleMenuController from "../controller/Sys/SysRoleMenuController";
import SysUserController from "../controller/Sys/SysUserController";
import SysMenuController from "../controller/SysMenuController";
import JwtAothMiddleWare from "../middleware/JwtAothMiddleWare";
import FileController from "../controller/updalod/FileController";
import updateMyInfo from "../controller/Sys/updateMyInfo";

// 前缀
const router = new KoaRouter({ prefix: "/meng" });
// 登录
router.post("/Adminuser/Login", AdminController.LoginAdmin);
// 获取验证码，未完成
router.get("/captcha", captchaCodeController.setCaptcha);
// 验证token
router.use(JwtAothMiddleWare);

router.post("/Adminuser/updata", AdminController.updaUser);

// 用户操作
router.get("/sys/user/list", SysUserController.getUserList);
router.post("/sys/user/update", SysUserController.updateUserById);
router.get("/sys/user/info", SysUserController.selectUserById);
router.post("/sys/user/add", SysUserController.addUser);
router.post("/sys/user/delete", SysUserController.deleteUser);


// 路由操作
router.post("/sys/role/add", SysRoleController.addRole);
router.post("/sys/role/update", SysRoleController.updateRoleById);
router.get("/sys/role/list", SysRoleController.getRoleList);
router.post("/sys/role/delete", SysRoleController.deleteRole);
router.get("/sys/role/info", SysRoleController.getRoleInfo);

// 权限操作
router.get("/sys/sys_menu/nav", SysMenuController.getSysMenuNav);
router.get("/sys/sys_menu/list", SysMenuController.getSysMenuList);
router.get("/sys/sys_menu/select", SysMenuController.getSysMenuSelect);
router.post("/sys/sys_menu/save", SysMenuController.saveSysMenu);
router.post("/sys/sys_menu/update", SysMenuController.updateSysMenu);
router.post("/sys/sys_menu/delete", SysMenuController.deleteSysMenu);

router.post("/sys/updateMyAvatarUrl",updateMyInfo.updateMyAvatarUrl);


router.post("/sys/file", FileController.image);

export default router;
